<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>监管单位--勘察成果备案审核(住建--人防)--详情</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <!--<script type="text/javascript" src="/templates/act/process-xl.js"></script>-->
    <style>
        .content {
            position: relative;
        }

        .btnBox {
            position: absolute;
            top: 10px;
            right: 10px;
            z-index: 1000;
        }
    </style>
</head>
<body>
<div class="content" id="view">

</div>
<script src="/static/js/main.js"></script>
<script type="text/javascript">
    layui.use(['configureCom', 'configure', 'bluebird', 'baseTab', 'sessionFun', 'jquery', 'process'], function () {
        var configure = layui.configure;
        var configureCom = layui.configureCom;
        var baseTab = layui.baseTab;
        var sessionFun = layui.sessionFun;
        var process = layui.process;
        var $ = layui.jquery;
        var loginData = sessionFun.get(configure.SESSION_LOGIN_INFOR_DATA);//获取登录信息
        var listData = sessionFun.get(configure.SESSION_PROJECT_WAIT_LIST_DATA);
        if(loginData.result.org.orgType  == 5){//住建
            if(listData.submitExamInfo.indexOf('1') > -1){//仅勘察
                var tabData = {
                    btns: [
                        {name: '保存并提交', event: 'submit'},
                        {name: '关闭', event: 'close'}
                    ],
                    tabList: [
                        {
                            title: '项目管理',
                            url: configure.PRJ_DETAIL_ALL_READ_HTML
                        }, {
                            title: '项目文件',
                            url: configure.PRJ_FILE_READ_HTML
                        }, {
                            title: '勘察报告信息',
                            url: configure.PRJ_KC_REPORT_LIST_READ_HTML
                        }, {
                            title: '设计报告信息',
                            url: configure.PRJ_SJ_REPORT_LIST_READ_HTML
                        }, {
                            title: '审查机构遴选',
                            url: configure.ORG_SELECTION_BODIES_READ_HTML
                        }, {
                            title: '审查信息',
                            url: configure.PRJ_REVIEW_OPINIONS_READ_HTML
                        }
                    ]
                };
            }
            if(listData.submitExamInfo.indexOf('2') > -1 || listData.submitExamInfo.indexOf('3') > -1){//仅设计
                if(listData.unionRecordInfo == null){//联合备案内容未勾选
                    var tabData = {
                        btns: [
                            {name: '保存并提交', event: 'submit'},
                            {name: '关闭', event: 'close'}
                        ],
                        tabList: [
                            {
                                title: '项目管理',
                                url: configure.PRJ_DETAIL_ALL_READ_HTML
                            }, {
                                title: '项目文件',
                                url: configure.PRJ_FILE_READ_HTML
                            }, {
                                title: '勘察报告信息',
                                url: configure.PRJ_KC_REPORT_LIST_READ_HTML
                            }, {
                                title: '设计报告信息',
                                url: configure.PRJ_SJ_REPORT_LIST_READ_HTML
                            }, {
                                title: '审查机构遴选',
                                url: configure.ORG_SELECTION_BODIES_READ_HTML
                            }, {
                                title: '审查信息',
                                url: configure.PRJ_REVIEW_OPINIONS_READ_HTML
                            }
                        ]
                    };
                }
                if(listData.unionRecordInfo != null){//联合备案内容未勾选
                    var tabData = {
                        btns: [
                            {name: '查看人防备案意见', event: 'defense'},
                            {name: '保存并提交', event: 'submit'},
                            {name: '关闭', event: 'close'}
                        ],
                        tabList: [
                            {
                                title: '项目管理',
                                url: configure.PRJ_DETAIL_ALL_READ_HTML
                            }, {
                                title: '项目文件',
                                url: configure.PRJ_FILE_READ_HTML
                            }, {
                                title: '勘察报告信息',
                                url: configure.PRJ_KC_REPORT_LIST_READ_HTML
                            }, {
                                title: '设计报告信息',
                                url: configure.PRJ_SJ_REPORT_LIST_READ_HTML
                            }, {
                                title: '审查机构遴选',
                                url: configure.ORG_SELECTION_BODIES_READ_HTML
                            }, {
                                title: '审查信息',
                                url: configure.PRJ_REVIEW_OPINIONS_READ_HTML
                            }
                        ]
                    };
                }

            }
            if(listData.submitExamInfo.indexOf('1') > -1 && listData.submitExamInfo.indexOf('2') > -1 || listData.submitExamInfo.indexOf('3') > -1){//既有勘察又有设计
                if(listData.unionRecordInfo == null){
                    var tabData = {
                        btns: [
                            {name: '保存并提交', event: 'submit'},
                            {name: '关闭', event: 'close'}
                        ],
                        tabList: [
                            {
                                title: '项目管理',
                                url: configure.PRJ_DETAIL_ALL_READ_HTML
                            }, {
                                title: '项目文件',
                                url: configure.PRJ_FILE_READ_HTML
                            }, {
                                title: '勘察报告信息',
                                url: configure.PRJ_KC_REPORT_LIST_READ_HTML
                            }, {
                                title: '设计报告信息',
                                url: configure.PRJ_SJ_REPORT_LIST_READ_HTML
                            }, {
                                title: '审查机构遴选',
                                url: configure.ORG_SELECTION_BODIES_READ_HTML
                            }, {
                                title: '审查信息',
                                url: configure.PRJ_REVIEW_OPINIONS_READ_HTML
                            }
                        ]
                    };
                }
                if(listData.unionRecordInfo != null){
                    var tabData = {
                        btns: [
                            {name: '查看人防备案意见', event: 'defense'},
                            {name: '保存并提交', event: 'submit'},
                            {name: '关闭', event: 'close'}
                        ],
                        tabList: [
                            {
                                title: '项目管理',
                                url: configure.PRJ_DETAIL_ALL_READ_HTML
                            }, {
                                title: '项目文件',
                                url: configure.PRJ_FILE_READ_HTML
                            }, {
                                title: '勘察报告信息',
                                url: configure.PRJ_KC_REPORT_LIST_READ_HTML
                            }, {
                                title: '设计报告信息',
                                url: configure.PRJ_SJ_REPORT_LIST_READ_HTML
                            }, {
                                title: '审查机构遴选',
                                url: configure.ORG_SELECTION_BODIES_READ_HTML
                            }, {
                                title: '审查信息',
                                url: configure.PRJ_REVIEW_OPINIONS_READ_HTML
                            }
                        ]
                    };
                }
            }
        }
        if(loginData.result.org.orgType  == 8){//人防
            var tabData = {
                btns: [
                    {name: '填写备案意见', event: 'opinion'},
                    {name: '保存并提交', event: 'submit'},
                    {name: '关闭', event: 'close'}
                ],
                tabList: [
                    {
                        title: '项目管理',
                        url: configure.PRJ_DETAIL_ALL_READ_HTML
                    }, {
                        title: '项目文件',
                        url: configure.PRJ_FILE_READ_HTML
                    }, {
                        title: '勘察报告信息',
                        url: configure.PRJ_KC_REPORT_LIST_READ_HTML
                    }, {
                        title: '设计报告信息',
                        url: configure.PRJ_SJ_REPORT_LIST_READ_HTML
                    }, {
                        title: '审查机构遴选',
                        url: configure.ORG_SELECTION_BODIES_READ_HTML
                    }, {
                        title: '审查信息',
                        url: configure.PRJ_REVIEW_OPINIONS_READ_HTML
                    }
                ]
            };
        }
        baseTab.init(tabData, 0);
        form.on('submit', function (data) {
            var event = $(data.elem).attr('lay-event');
            switch (event) {
                case 'opinion':
                    opinion();
                    break;
                case 'defense':
                    defense();
                    break;
                case 'submit':
                    submit();
                    break;
                case 'close':
                    top.layer.closeAll();
                    break;
            }
            return false;
        });

        //填写备案意见
        function opinion() {
            top.layer.open({
                type: 2,
                title: "填写备案意见",
                area: configureCom.Psize1,
                content: configureCom.nocache(configure.ORG_FILING_OPINIONS_HTML),
                btn:['提交'],
                btnAlign: 'c',
                yes: function (index, layero) {
                    var iframeWin = top.window.frames['layui-layer-iframe' + index]; //得到iframe页的窗口对
                    iframeWin.getData().then(function (res) {
                        console.log(res);
                        var nextAll={
                            decId : listData.decId,
                            rfRecordResult:res.result.rfRecordResult,
                            rfRecordAdvise:res.result.rfRecordAdvise,
                        };
                        configureCom.postDataAjax(configure.PRJ_DECLARE_SUBMIT_RF_RECORD_HTTP, nextAll).then(function (res) {
                            console.log(res);
                            top.layer.close(index);
                            top.layer.msg('提交成功');
                        });
                    });
                }
            });
        }
        //查看人防备案意见
        function defense() {
            top.layer.open({
                type: 2,
                title: "查看人防备案意见",
                area: configureCom.Psize1,
                content: configureCom.nocache(configure.ORG_VIEW_OPINIONS_HTML),
                btn:['关闭'],
                btnAlign: 'c'
            });
        }
        //保存并提交方法
        function submit() {
            process.next({
                "taskId": listData.taskId,
                "poId": listData.poId
            });
        }
    });


</script>
</body>
</html>